<?php

$name = getInputArray("name", $params,'');
$validate = getInputArray("validate", $params,'');
$id = getInputArray("id", $params,str_replace(".","",str_replace(" ","",microtime())));
$required = getInputArray("required", $params,false);
$disabled = getInputArray("disabled", $params,false);
$readOnly = getInputArray("readonly", $params, false);
$text = getInputArray("text", $params,'');
$value = getInputArray("value", $params, $text);
$labelid = str_replace(".","",str_replace(" ","",microtime()));
$messageRequired = getInputArray("messageRequired", $params,langEcho("messageRequired"));
$class = getInputArray("class", $params,'');
$validateOnBlur = getInputArray("validateOnblur", $params,true);
$style = getInputArray("style", $params, "");

$requiredString = "false";
if($required){
	$requiredString = "true";
}

?>
 
<?php
echo "<input type='text' "; 
if ($name != "") echo " name='" . $name ."' ";

if ($class != "") echo " class='" . $class ."' ";
 
if ($id != "") echo " id='" . $id ."' ";

if ($disabled != ""){
	echo " disabled='disabled' ";
}

if ($style != ""){
	echo " style='".$style."' ";
}

if ($readOnly) echo " readonly='readonly' ";

$onfocus = "";
$onblur = "";
if($text != ''){
	$onfocus .= "cleanValue('$id','$text');";
	$onblur .= "setValue('$id','$text');";
}

if($onfocus != ''){
	echo " onfocus=\"$onfocus\" ";
}

if ($validateOnBlur){
	$onblur .= " validate_string(this.value, " . $requiredString . ", '" . $labelid . "','".$messageRequired."', '".$text."');";
} 
if($onblur != ''){
	echo "onblur=\"$onblur\"";
}

if ($value != "") echo " value='" . $value ."' ";

echo "/><span class='validateTextbox' id='".$labelid."' ></span>";

if($validate != ''){
echo '<script type="text/javascript">';
echo "registerValidation('$validate', '$id',$requiredString, 'string', '$labelid', '$messageRequired', '', '$text')";
echo '</script>';
}
?>